package gat.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

/**
 * @Author sxq
 * @Date 2022/3/15
 * @Version 1.0
 */

@Getter
@AllArgsConstructor
@NoArgsConstructor
public enum DirectionEnum {

    INTO_BALANCE("I", "into_balance"),
    BALANCE_OUT("O", "balance_out"),

    FREEZE_OUT("O", "freeze_out"),

    BALANCE_TO_FREEZE("-", "balance_freeze"),
    FREEZE_TO_BALANCE("-", "freeze_balance"),
    ;

    private String type;
    private String code;

    public static DirectionEnum getByCode(String code) {
        for (DirectionEnum value : values()) {
            if (String.valueOf(value.getCode()).equals(code)) {
                return value;
            }
        }
        return null;
    }

}
